package com.breaktian.share.action;

import android.content.Context;

import com.breaktian.share.ShareChannel;
import com.breaktian.share.ShareEntity;
import com.sina.weibo.sdk.WeiboAppManager;
import com.sina.weibo.sdk.auth.WbAppInfo;

public class WeiboAction implements ShareAction{
    private final Context mContext;

    public WeiboAction(Context context) {
        this.mContext = context;
    }

    @Override
    public boolean isAppInstalled() {
        WbAppInfo wbAppInfo = WeiboAppManager.getInstance(mContext.getApplicationContext()).getWbAppInfo();
        return wbAppInfo != null && wbAppInfo.isLegal();
    }

    @Override
    public void share(ShareEntity entry, ShareChannel channel) {
        ShareActivity.start(mContext, entry, channel.getType());
    }
}
